/* GUI CONVERTED from ecdump.i (converter v1.75) Mon Aug 14 12:25:47 2000 */
/* ecdump.i - ECN DUMP INCLUDE FILE                                     */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*F0PN*/ /*V8:ConvertMode=Maintenance                                   */
/*K1Q4*/ /*V8:WebEnabled=No                                             */
/* REVISION: 7.4      LAST EDIT: 09/20/93      MODIFIED BY: QZL *H013*  */
/* REVISION: 7.4      LAST EDIT: 04/18/94      MODIFIED BY: QZL *H358*  */
/* REVISION: 7.4      LAST EDIT: 12/01/94      MODIFIED BY: QZL *H612*  */
/* REVISION: 7.4      LAST EDIT: 08/01/95      MODIFIED BY: QZL *H0F9*  */
/* REVISION: 7.4      LAST EDIT: 12/29/95      MODIFIED BY: qzl *H0J1*  */
/* REVISION: 8.6      LAST EDIT: 06/12/96 MODIFIED BY: Mariya Kutwal *K00C*  */
/* REVISION: 8.6      LAST EDIT: 01/23/97      MODIFIED BY: John Worden *K04Z**/
/* REVISION: 8.6      LAST EDIT: 06/25/97      MODIFIED BY: Joe Gawel *K0F4* */
/* REVISION: 8.6      LAST MODIFIED: 08/13/97   BY: Joe Gawel    *K0H5* */
/* REVISION: 8.6      LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 08/14/00   BY: *N0KW* Jacolyn Neder      */

/*K0F4*  THE INCLUDE FILES USED FOR THIS PATCH (ECRODEF.I, ECROGET.I    */
/*K0F4*  AND ECROPUT.I) SHOULD BE REMOVED ONCE THE NEW FIELDS HAVE BEEN */
/*K0F4*  ADDED TO THE ECD2_DET TABLE IN THE SCHEMA.                     */

/*K00C* ecd9_det table is replaced with rsu_mstr and rsud_det tables
 *K00C*/

/*H0F9*         if ecm_nbr = "*000000*" then next. */

/*H0F9*/        if {&ecdump} then do:
       no_rec[1] = no_rec[1] + 1.

/*H358*            if dmpld then display substring(ecm_nbr,1,8) @ ecnbr
       substring(ecm_nbr,9,8) @ ecid
       substring(ecm_nbr,17,8) @ ecdb
       "ecm_mstr" @ filename with frame aa.   ***H358*/

/*H612*            export stream ecinout "type:ecm_mstr" ecm_nbr "" "" "". */
/*H612*            export stream ecinout ecm_mstr except ecm_nbr.          */
/*K0H5* /*H612*/           export stream ecinout "type:ecm_mstr" ecm_nbr ecm_type */
/*K0H5*/           export stream ecinout "type:ecm_mstr" ecm_mstr.ecm_nbr ecm_type
/*H612*/                                  ecm_assign "".
/*H612*/           export stream ecinout ecm_mstr except ecm_nbr ecm_type
/*H612*/                                 ecm_assign.
/*H0F9*/        end.

    cmtseq = 0.
    if ecm_cmtindx <> 0 then
/*H0F9*         for each cmt_det where cmt_indx = ecm_cmtindx no-lock:  */
/*H0F9*/        for each cmt_det where cmt_indx = ecm_cmtindx {&lock-type}:
/*H0F9*/           if {&ecdump} then do:
          export stream ecinout "type:cmt_det" string(ecm_cmtindx)
          string(cmt_seq) "ecm_mstr" string(cmtseq).
          export stream ecinout cmt_det except cmt_det.cmt_indx
          cmt_det.cmt_seq.
          cmtseq = cmtseq + 1.
/*H358*             if dmpld then display "cmt_det" @ filename with frame aa.*/
          no_rec[7] = no_rec[7] + 1.
/*H0F9*/           end.
/*H0F9*/           if {&ecdelete} then delete cmt_det.
    end.

    if can-find(first ecd1_det where ecd1_nbr = ecm_nbr) then do:
/*H0F9*            for each ecd1_det where ecd1_nbr = ecm_nbr no-lock: */
/*H0F9*/           for each ecd1_det where ecd1_nbr = ecm_nbr {&lock-type}:
/*H358*               if dmpld then display "ecd1_det" @ filename
          with frame aa. */
/*H0F9*/              if {&ecdump} then do:
/*K0H5* /*H0J1*/                 find qad_wkfl {&lock-type} where              */
/*K0H5* /*H0J1*/                 qad_key1 = "ECN-STRUCTURE" and qad_key2 =     */
/*K0H5* /*H0J1*/                 string(recid(ecd1_det)) no-error.             */
/*K0H5* /*H0J1*/                 if available qad_wkfl then                    */
/*K0H5* /*H0J1*/                 export stream ecinout "type:ecd1_det*" ecm_nbr*/
/*K0H5* /*H0J1*/                 ecd1_par ecd1_comp ecd1_ref.                  */
/*K0H5* /*H0J1*/                 else                                          */
       export stream ecinout "type:ecd1_det" ecm_nbr
       ecd1_par ecd1_comp ecd1_ref.
       export stream ecinout ecd1_det except ecd1_nbr ecd1_par
       ecd1_comp ecd1_ref.
/*K0H5* /*H0J1*/                 if available qad_wkfl then                    */
/*K0H5* /*H0J1*/                 export stream ecinout qad_wkfl except qad_key1*/
/*K0H5* /*H0J1*/                 qad_key2.                                     */
/*K0H5* /*H0J1*/                 if {&ecdelete} and available qad_wkfl         */
/*K0H5* /*H0J1*/                 then delete qad_wkfl.                         */

       no_rec[3] = no_rec[3] + 1.
/*H0F9*/              end.

          cmtseq = 0.
          if ecd1_cmtindx <> 0 then
/*H0F9*               for each cmt_det where cmt_indx = ecd1_cmtindx no-lock: */
/*H0F9*/              for each cmt_det where cmt_indx = ecd1_cmtindx
/*H0F9*/              {&lock-type}:
/*H0F9*/                 if {&ecdump} then do:
          export stream ecinout "type:cmt_det"
          string(ecd1_cmtindx) string(cmt_seq) "ecd1_det"
          string(cmtseq).
          export stream ecinout cmt_det except
          cmt_det.cmt_indx cmt_det.cmt_seq.
/*H358*                     if dmpld then display "cmt_det" @ filename
          with frame aa. */
          cmtseq = cmtseq + 1.
          no_rec[7] = no_rec[7] + 1.
/*H0F9*/                 end.
/*H0F9*/                 if {&ecdelete} then delete cmt_det.
          end.
/*H0F9*/              if {&ecdelete} then delete ecd1_det.
       end.
    end.

    if can-find(first ecd2_det where ecd2_nbr = ecm_nbr) then do:
/*H0F9*            for each ecd2_det where ecd2_nbr = ecm_nbr no-lock: */
/*H0F9*/           for each ecd2_det where ecd2_nbr = ecm_nbr {&lock-type}:
/*GUI*/ if global-beam-me-up then undo, leave.


/*K0F4*/             {ecroget.i &nbr=ecd2_nbr
                                &routing=ecd2_routing
                                &op=ecd2_op
                                &lock={&lock-type}}

/*H358*               if dmpld then display "ecd2_det" @ filename
          with frame aa.   */
/*H0F9*/              if {&ecdump} then do:
       export stream ecinout "type:ecd2_det" ecm_nbr
       ecd2_routing string(ecd2_op) "".
       export stream ecinout ecd2_det except ecd2_nbr
       ecd2_routing ecd2_op.

/*K0F4* REMOVE FOLLOWING LINE WHEN NEW FIELDS ADDED TO ECD2_DET */
/*K0F4*/ export stream ecinout qad_wkfl.

       no_rec[5] = no_rec[5] + 1.
/*H0F9*/              end.

          cmtseq = 0.
          if ecd2_cmtindx <> 0 then
/*H0F9*               for each cmt_det where cmt_indx = ecd2_cmtindx no-lock: */
/*H0F9*/              for each cmt_det where cmt_indx = ecd2_cmtindx
/*H0F9*/              {&lock-type}:
/*H0F9*/                 if {&ecdump} then do:
          export stream ecinout "type:cmt_det"
          string(ecd2_cmtindx) string(cmt_seq) "ecd2_det"
          string(cmtseq).
          export stream ecinout cmt_det except
          cmt_det.cmt_indx cmt_det.cmt_seq.
/*H358*                     if dmpld then display "cmt_det" @ filename
          with frame aa.   */
          cmtseq = cmtseq + 1.
          no_rec[7] = no_rec[7] + 1.
/*H0F9*/                 end.
/*H0F9*/                 if {&ecdelete} then delete cmt_det.
          end.
/*H0F9*/              if {&ecdelete} then delete ecd2_det.
/*K0F4*/              if {&ecdelete} and available qad_wkfl then delete qad_wkfl.
       end.
/*GUI*/ if global-beam-me-up then undo, leave.

    end.

    if can-find(first ecd3_det where ecd3_nbr = ecm_nbr) then do:
/*H0F9*            for each ecd3_det where ecd3_nbr = ecm_nbr no-lock: */
/*H0F9*/           for each ecd3_det where ecd3_nbr = ecm_nbr {&lock-type}:
/*H358*               if dmpld then display "ecd3_det" @ filename
          with frame aa. */
/*H0F9*/              if {&ecdump} then do:
       export stream ecinout "type:ecd3_det" ecm_nbr
       string(ecd3_cmtindx) "" "".
       export stream ecinout ecd3_det except ecd3_nbr
       ecd3_cmtindx.
       no_rec[2] = no_rec[2] + 1.
/*H0F9*/              end.

          cmtseq = 0.
          if ecd3_cmtindx <> 0 then
/*H0F9*               for each cmt_det where cmt_indx = ecd3_cmtindx no-lock: */
/*H0F9*/              for each cmt_det where cmt_indx = ecd3_cmtindx
/*H0F9*/              {&lock-type}:
/*H0F9*/                 if {&ecdump} then do:
          export stream ecinout "type:cmt_det"
          string(ecd3_cmtindx) string(cmt_seq) "ecd3_det"
          string(cmtseq).
          export stream ecinout cmt_det except
          cmt_det.cmt_indx cmt_det.cmt_seq.
/*H358*                     if dmpld then display "cmt_det" @ filename
          with frame aa.  */
          cmtseq = cmtseq + 1.
          no_rec[7] = no_rec[7] + 1.
/*H0F9*/                 end.
/*H0F9*/                 if {&ecdelete} then delete cmt_det.
          end.
/*H0F9*/              if {&ecdelete} then delete ecd3_det.
       end.
    end.

/*K00C*/  if can-find(first ecd4_det where ecd4_nbr = ecm_nbr) then do:
/*K00C*/           for each ecd4_det where ecd4_nbr = ecm_nbr {&lock-type}:
/*K00C*/
/*K00C*/              if {&ecdump} then do:
/*K00C*/     export stream ecinout "type:ecd4_det" ecm_nbr
/*K00C*/     string(ecd4_cmtindx) "" "".
/*K00C*/     export stream ecinout ecd4_det except ecd4_nbr
/*K00C*/     ecd4_cmtindx.
/*K04Z* /*K00C*/     no_rec[2] = no_rec[2] + 1. */
/*K04Z*/     no_rec[9] = no_rec[9] + 1.
/*K00C*/              end.
/*K00C*/
/*K00C*/        cmtseq = 0.
/*K00C*/        if ecd4_cmtindx <> 0 then
/*K00C*/              for each cmt_det where cmt_indx = ecd4_cmtindx
/*K00C*/              {&lock-type}:
/*K00C*/                 if {&ecdump} then do:
/*K00C*/        export stream ecinout "type:cmt_det"
/*K00C*/        string(ecd4_cmtindx) string(cmt_seq) "ecd4_det"
/*K00C*/        string(cmtseq).
/*K00C*/        export stream ecinout cmt_det except
/*K00C*/        cmt_det.cmt_indx cmt_det.cmt_seq.
/*K00C*/        cmtseq = cmtseq + 1.
/*K00C*/        no_rec[7] = no_rec[7] + 1.
/*K00C*/                 end.
/*K00C*/                 if {&ecdelete} then delete cmt_det.
/*K00C*/        end.
/*K00C*/              if {&ecdelete} then delete ecd4_det.
/*K00C*/     end.
/*K00C*/  end.

/*K00C**  if can-find(first ecd9_det where ecd9_nbr = ecm_nbr) then do:
 * /*H0F9*            for each ecd9_det where ecd9_nbr = ecm_nbr no-lock: */
 * /*H0F9*/           for each ecd9_det where ecd9_nbr = ecm_nbr {&lock-type}:
 * /*H358*               if dmpld then display "ecd9_det" @ filename
 *          with frame aa.  */
 * /*H0F9*/              if {&ecdump} then do:
 *       export stream ecinout "type:ecd9_det" ecm_nbr
 *       ecd9_group "" "".
 *       export stream ecinout ecd9_det except ecd9_nbr
 *       ecd9_group.
 *       no_rec[4] = no_rec[4] + 1.
 * /*H0F9*/              end.
 * /*H0F9*/              if {&ecdelete} then delete ecd9_det.
 *       end.
 *    end.
 *K00C****added code below*****/
          if can-find(first rsu_mstr where rsu_doc_nbr = ecm_nbr) then do:
              for each rsu_mstr where rsu_doc_nbr = ecm_nbr {&lock-type}:
                 if {&ecdump} then do:
                 export stream ecinout "type:rsu_mstr" ecm_nbr
                 rsu_index "" "".
                 export stream ecinout rsu_mstr except rsu_doc_nbr rsu_index.
                  end.
                  for each rsud_det where rsud_index = rsu_index {&lock-type}:
                    if {&ecdump} then do:
                    export stream ecinout "type:rsud_det" rsud_group
                        rsu_index "" "".
                        export stream ecinout rsud_det except rsud_group
                        rsud_index.
               no_rec[4] = no_rec[4] + 1.
                    end.
          cmtseq = 0.
          if rsud_cmmtindx <> 0 then
                      for each cmt_det where cmt_indx = rsud_cmmtindx
                      {&lock-type}:
                         if {&ecdump} then do:
          export stream ecinout "type:cmt_det"
          string(rsud_cmmtindx) string(cmt_seq) "rsud_det"
          string(cmtseq).
          export stream ecinout cmt_det except
          cmt_det.cmt_indx cmt_det.cmt_seq.
          cmtseq = cmtseq + 1.
          no_rec[7] = no_rec[7] + 1.
                         end.
                         if {&ecdelete} then delete cmt_det.
          end.
                    if {&ecdelete} then delete rsud_det.
                 end. /* for each rsud_det*/

                 if {&ecdelete} then delete rsu_mstr.
               end. /* for each rsu_mstr */
          end. /* if can find first rsu_mstr */
/*K00C*****added coded above******/

    if can-find(first ecd_det where ecd_nbr = ecm_nbr) then do:
/*H0F9*            for each ecd_det where ecd_nbr = ecm_nbr no-lock: */
/*H0F9*/           for each ecd_det where ecd_nbr = ecm_nbr {&lock-type}:
/*H358*               if dmpld then display "ecd_det" @ filename
          with frame aa.  */
/*H0F9*/              if {&ecdump} then do:
       export stream ecinout "type:ecd_det" ecm_nbr
       ecd_part string(ecd_new) "".
       export stream ecinout ecd_det except ecd_nbr ecd_part
       ecd_new.
       no_rec[6] = no_rec[6] + 1.
/*H0F9*/              end.

          cmtseq = 0.
          if ecd_cmtindx <> 0 then
/*H0F9*              for each cmt_det where cmt_indx = ecd_cmtindx no-lock:*/
/*H0F9*/             for each cmt_det where cmt_indx = ecd_cmtindx
/*H0F9*/             {&lock-type}:
/*H0F9*/                 if {&ecdump} then do:
          export stream ecinout "type:cmt_det"
          string(ecd_cmtindx) string(cmt_seq) "ecd_det"
          string(cmtseq).
          export stream ecinout cmt_det except
          cmt_det.cmt_indx cmt_det.cmt_seq.
/*H358*                     if dmpld then display "cmt_det" @ filename
          with frame aa.   */
          cmtseq = cmtseq + 1.
          no_rec[7] = no_rec[7] + 1.
/*H0F9*/                 end.
/*H0F9*/                 if {&ecdelete} then delete cmt_det.
          end.
/*H0F9*/              if {&ecdelete} then delete ecd_det.
       end.
    end.
/*H0F9*/        if {&ecdelete} then delete ecm_mstr.
